<template>
  <div>
    <Hearder />
    <el-card>
        <el-row>
            <el-col :span=8>
  <el-input placeholder="请输入内容" v-model="queryInfo.query">
    <el-button slot="append" icon="el-icon-search" @click="getListItem"></el-button>
  </el-input>

            </el-col>
        </el-row>
  
      <el-table :data="goodList" style="width: 100%" border stripe>
           <el-table-column type=index >
        </el-table-column>
        <el-table-column prop="order_number" label="订单编号" width="280">
        </el-table-column>
        <el-table-column prop="order_price" label="订单价格" width="180">
        </el-table-column>
        <el-table-column prop="is_send" label="是否付款">
            <template slot-scope="scope">
                <el-tag v-if="scope.row.pay_status==0" type='danger'>未付款</el-tag>
                  <el-tag v-else type='success'>已付款</el-tag>
            </template>
             </el-table-column>
              <el-table-column prop="is_send" label="是否发货"> </el-table-column>
        <el-table-column prop="create_time" label="下单时间" width="280"> </el-table-column>
        <el-table-column label="操作" >
            <el-button type="primary" icon="el-icon-edit" @click="operation"></el-button>
            <el-button type="danger" icon="el-icon-position" @click="logistics"></el-button>
             </el-table-column>
        </el-table>
         <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="queryInfo.pagenum"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="queryInfo.pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
    </el-card>
    <el-dialog
  title="修改地址"
  :visible.sync="dialogVisible"
  >
  <span>这是一段信息</span>
  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  </span>

</el-dialog>
 <el-dialog
  title="修改地址"
  :visible.sync="Visible"
  >
   <el-timeline >
    <el-timeline-item
      v-for="(activity, index) in goodsInfo"
      :key="index"
      :timestamp="activity.times">
      {{activity.context}}
    </el-timeline-item>
  </el-timeline>

  <span slot="footer" class="dialog-footer">
    <el-button @click="Visible = false">取 消</el-button>
    <el-button type="primary" @click="Visible = false">确 定</el-button>
  </span>
</el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
        goodsInfo:[],
        Visible:false,
        dialogVisible:false,
        total:0,
        goodList:[],
      queryInfo:{
          query:'',
          pagenum:1,
          pagesize:5
      }
    };
  },
  methods: {
     async logistics(){
         const {data:res}=await this.$http.get(`/kuaidi/${1106975712662}`).catch(err=>err)
            console.log(res);
            this.goodsInfo=res.data
            this.Visible=true
      },
    operation(){
        this.dialogVisible=true
    },
      handleSizeChange(val){
          this.queryInfo.pagesize=val
         this.getListItem()
      },
      handleCurrentChange(val){
          this.queryInfo.pagenum=val
          this.getListItem()

      },

     async getListItem(){
         const {data:res} =await this.$http.get('orders',{params:this.queryInfo}).catch(err=>err)
          console.log(res);
          this.goodList=res.data.goods
          this.total=res.data.total
          this.time=res.data.goods.map(item=>item.create_time=this.$moment(item.create_time).format('LLLL'))

      }
  },
  mounted() {
        this.getListItem()
  },
};
</script>

<style scoped>

</style>


